<template>
  <div class="success">
    <div class="header">
      <p>支付成功</p>
    </div>
    <div class="center">
      <van-icon color="rgb(26,188,156)" name="checked" size="60" />
      <p>订单支付成功</p>
      <div class="pay">
        <van-icon name="idcard" size="22" color="#d3d3d3" />
        <b>支付方式</b>
        <span>微信支付</span>
      </div>
      <div class="num">
        <van-icon name="after-sale" size="22" color="#d3d3d3" />
        <b>支付金额</b>
        <span>￥{{money | fix}}</span>
      </div>
      <div class="btn">
        <van-button hairline @click="handleDeliverGoods" plain color="#999" type="default">查看订单</van-button>
        <van-button hairline @click="handleHome" plain color="#999" type="default">回到首页</van-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'success',
  data() {
    return {
      money: 0,
    }
  },
  created() {
    this.money = JSON.parse(localStorage.getItem('money'))
  },
  mounted() {
    localStorage.removeItem('money')
  },
  methods: {
    handleHome() {
      this.$router.push('/home')
    },
    handleDeliverGoods() {
      this.$router.push('/delivergoods')
    },
  },
}
</script>

<style lang="scss" scoped>
.van-button {
  width: 120px;
  height: 35px;
}
.header {
  background-color: #f9f9f9;
  height: 45px;
  border: 1px solid #f2f2f2;
  p {
    color: #999;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    line-height: 45px;
  }
}
.center {
  width: 280px;
  margin: 80px auto;
  text-align: center;
  p {
    color: #999;
    font-size: 20px;
    margin-top: 10px;
  }
  b {
    font-weight: normal;
    color: #999;
    margin: 0 15px;
  }

  .pay {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    margin-top: 25px;
    > span {
      color: #f04844;
    }
  }
  .num {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    width: 155px;
    margin-left: 65px;
    > span {
      color: #f04844;
    }
  }
  .btn{
    display: flex;
    justify-content: space-between;
  }
}
</style>
